How does [self.tableView reloadData] know what data to reload?
Posted
by Scott Pendleton
on Stack Overflow
See other posts from Stack Overflow
or by Scott Pendleton
Published on 2010-03-14T14:02:56Z
Indexed on
2010/03/14
14:05 UTC
Read the original article
Hit count: 943
It bugs me to death that my viewcontroller, which happens to be a tableViewController, knows without being told that its property that is an NSArray or an NSDictionary holds the data that is to be loaded into the table for display.
Seems like I should explicitly say something like: [self.tableView useData:self.MyArray];
Because, THAT'S WHAT I WANT TO DO!
I want to have more than one array inside my tableViewController, and switch between one and the other programmatically.
Please do not give me an answer like: "Never mind what you want to do, just set up two different tableViewControllers." No. I want to do it my way.
I notice that when a tableViewController makes use of a searchViewController, you can do this:
if (tableView == self.searchDisplayController.searchResultsTableView) {
YES! I have even been able to do this:
self.tableView = self.searchDisplayController.searchResultsTableView; [self.tableView reloadData];
But nowhere can I find how to set self.tableView back to the main datasource!
I'm so tired of sifting, sifting through code for incomplete nuggets of enlightenment.
Allow me to understate that Apple's documentation is grossly inadequate. It's astounding that so many slick iPhone programs came to be created. People said that once I went Mac, I'd never go back to Windows. Well, I'm anything but a convert.
© Stack Overflow or respective owner